package com.yitao.client.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * 物流相关枚举
 *
 * @Date: 2019/6/4 19:42
 * @Author: Kien
 */
public class ExpressageSubscribeLogEnum {

    /**
     *
     * 功能描述: 物流单号订阅状态
     * @auther: Kien
     * @date: 2019/6/4 19:43
     */
    public enum EXPRESSAGE_SUBSCRIBE_STATUS{
        SUCCESS("200", "提交成功"),
        REFUSED_SUBSCRIBE("701", "拒绝订阅的快递公司 "),
        SUBSCRIBE_DATA_ERROR("700", "订阅方的订阅数据存在错误"),
        POLL_ERROR("702", "POLL:识别不到该单号对应的快递公司"),
        SUBSCRIBE_ILLEGAL("600", "授权Key出错"),
        KEY_FAILURE("601", " POLL:KEY已过期"),
        SERVER_ERROR("500", "服务器错误"),
        REPEAT_SUBSCRIBE("501", "重复订阅"),
        ;

        private String code;
        private String msg;
        private static Map<String, String> map = new HashMap<>();

        static {
            for(EXPRESSAGE_SUBSCRIBE_STATUS expressage_subscribe_status: EXPRESSAGE_SUBSCRIBE_STATUS.values()) {
                map.put(expressage_subscribe_status.getCode(), expressage_subscribe_status.msg);
            }
        }

        EXPRESSAGE_SUBSCRIBE_STATUS(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public String getCode() {
            return code;
        }

        public String getMsg() {
            return msg;
        }

        /**
         * 根据code获取对应msg
         *
         * @param code
         * @return
         */
        public static String getMsgByCode(String code) {
            return map.get(code);
        }
    }

    /**
     *
     * 功能描述: 物流信息来源类型
     *
     * @auther: Kien
     * @date: 2019/8/21 11:02
     */
    public enum EXPRESSAGE_JOINED_TYPE{
        KUAIDI100(1, "快递100"),
        JINGYI(99, "景逸")
        ;

        private Integer code;
        private String msg;

        EXPRESSAGE_JOINED_TYPE(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Integer getCode() {
            return code;
        }

        public String getMsg() {
            return msg;
        }

    }
}
